From 69e309b3b1217d524c801d52c12d1ffb20259a90 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 9 Nov 2005 14:41:14 +0100 Subject: [PATCH] Remove use of get_gendisk in blkfront gen_gendisk is no long exported by 2.6 kernel. Now blkfront can be built as a kernel module. Signed-off-by: Xiaofeng Ling Signed-off-by: Jeremy Katz --- .../drivers/xen/blkfront/blkfront.c | 1 + linux-2.6-xen-sparse/drivers/xen/blkfront/block.h | 1 + linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c | 14 ++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c index 70d9e0ba7d..c47b053b98 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c @@ -641,6 +641,7 @@ static int blkfront_probe(struct xenbus_device *dev, info->vdevice = vdevice; info->connected = BLKIF_STATE_DISCONNECTED; info->mi = NULL; + info->gd = NULL; INIT_WORK(&info->work, blkif_restart_queue, (void *)info); info->shadow_free = 0; diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h index 24388e84e5..c3149f5dee 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h @@ -116,6 +116,7 @@ struct blkfront_info /* We watch the backend */ struct xenbus_watch watch; dev_t dev; + struct gendisk *gd; int vdevice; blkif_vdev_t handle; int connected; diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c index 49a6ab4882..fdc78c315f 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c @@ -259,6 +259,7 @@ xlvbd_alloc_gendisk(int minor, blkif_sector_t capacity, int vdevice, gd->flags |= GENHD_FL_CD; add_disk(gd); + info->gd = gd; return 0; @@ -292,22 +293,19 @@ void xlvbd_del(struct blkfront_info *info) { struct block_device *bd; - struct gendisk *gd; - int unused; - request_queue_t *rq; bd = bdget(info->dev); if (bd == NULL) return; - gd = get_gendisk(info->dev, &unused); - rq = gd->queue; + if (info->gd == NULL) + return; - del_gendisk(gd); - put_disk(gd); + del_gendisk(info->gd); + put_disk(info->gd); xlbd_put_major_info(info->mi); info->mi = NULL; - blk_cleanup_queue(rq); + blk_cleanup_queue(info->rq); bdput(bd); } -- 2.30.2